﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BindingLesson.DataValidation
{
    public class Data : INotifyPropertyChanged
    {
        private int _value;

        public event PropertyChangedEventHandler? PropertyChanged;

        public int Value
        {
            get { return _value; }
            set
            {
                //if (value == 123)
                //    throw new Exception("比如不能输入123");

                _value = value;
            }
        }

        public Data()
        {
            //Task.Run(async () =>
            //{
            //    await Task.Delay(3000);
            //    try
            //    {
            //        Value = 123;
            //        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Value"));
            //    }
            //    catch (Exception ex)
            //    {

            //    }
            //});
        }
    }
}
